//
//  YTParamView.m
//  YUNT
//
//  Created by 梁炜东 on 2017/11/22.
//  Copyright © 2017年 梁炜东. All rights reserved.
//

#import "YTParamView.h"

@interface YTParamView()
@property(nonatomic, strong)UIView *bgView;
@property(nonatomic, strong)UIButton *closeBtn;
@property(nonatomic, strong)UILabel *titleLabel;
@end

@implementation YTParamView

-(instancetype)init
{
    self = [super init];
    if (self)
    {
        
    }
    return self;
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    [self p_makeConstraints];
}
-(void)p_makeConstraints
{
    if (SharedApplication.statusBarOrientation == UIInterfaceOrientationPortrait ||
        SharedApplication.statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown)
    {//竖屏
    }else
    {//横屏  
    }
    [self mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.top.leading.bottom.trailing.equalTo(KeyWindow);
    }];
    [_bgView mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self);
        make.width.mas_equalTo(200);
        make.height.mas_equalTo(120);
    }];
    [_titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.top.leading.trailing.equalTo(_bgView);
        make.height.mas_equalTo(39);
    }];
    [_closeBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.leading.top.bottom.equalTo(_titleLabel);
        make.width.mas_equalTo(70);
    }];
}
-(UIView *)bgView
{
    if (!_bgView)
    {
        _bgView = [[UIView alloc] init];
        _bgView.backgroundColor = [UIColor clearColor];
        _bgView.layer.cornerRadius = 6;
        _bgView.layer.masksToBounds = YES;
    }
    return _bgView;
}
-(UIButton *)closeBtn
{
    if (!_closeBtn)
    {
        _closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _closeBtn.backgroundColor = [UIColor clearColor];
        [_closeBtn setTitle:Language(@"关闭") forState:UIControlStateNormal];
        [_closeBtn setTitleColor:YTColor(92, 204, 225) forState:UIControlStateNormal];
        _closeBtn.titleLabel.font = [UIFont systemFontOfSize:17];
        [_closeBtn addTarget:self action:@selector(closeAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _closeBtn;
}
-(UILabel *)titleLabel
{
    if (!_titleLabel)
    {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.backgroundColor = [UIColor blackColor];
        _titleLabel.textColor = [UIColor whiteColor];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        _titleLabel.userInteractionEnabled = YES;
        _titleLabel.text = Language(@"延时摄影");
    }
    return _titleLabel;
}
@end
